﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace 蓝光值计算
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] value1 = { 9.56E-06,1.14E-05,1.08E-05,9.95E-06,1.14E-05,1.06E-05,8.26E-06,6.42E-06,7.94E-06,9.05E-06,
9.07E-06,8.09E-06,6.72E-06,7.41E-06,1.03E-05,6.72E-06,5.49E-06,7.80E-06,8.75E-06,8.38E-06,
7.60E-06,7.87E-06,1.12E-05,1.02E-05,1.11E-05,1.23E-05,1.25E-05,1.37E-05,1.57E-05,1.80E-05,
2.10E-05,2.44E-05,2.44E-05,2.85E-05,3.37E-05,3.99E-05,4.61E-05,5.44E-05,6.07E-05,7.45E-05,
8.73E-05,1.02E-04,1.19E-04,1.46E-04,1.71E-04,2.01E-04,2.37E-04,2.77E-04,3.28E-04,3.81E-04,
4.44E-04,5.12E-04,5.96E-04,6.93E-04,7.97E-04,9.22E-04,1.07E-03,1.22E-03,1.39E-03,1.57E-03,
1.79E-03,2.03E-03,2.28E-03,2.55E-03,2.86E-03,3.17E-03,3.50E-03,3.84E-03,4.20E-03,4.53E-03,
4.83E-03,5.11E-03,5.32E-03,5.47E-03,5.53E-03,5.49E-03,5.37E-03,5.14E-03,4.87E-03,4.54E-03,
4.21E-03,3.87E-03,3.57E-03,3.28E-03,3.02E-03,2.80E-03,2.63E-03,2.50E-03,2.37E-03,2.26E-03,
2.17E-03,2.08E-03,1.99E-03,1.90E-03,1.80E-03,1.70E-03,1.60E-03,1.50E-03,1.40E-03,1.32E-03 };
            double[] value2 = { 1.23E-03,1.16E-03,1.08E-03,1.01E-03,9.55E-04,9.03E-04,8.53E-04,8.10E-04,7.69E-04,7.27E-04,
6.91E-04,6.64E-04,6.38E-04,6.13E-04,5.97E-04,5.85E-04,5.80E-04,5.80E-04,5.88E-04,6.02E-04,
6.21E-04,6.49E-04,6.84E-04,7.23E-04,7.72E-04,8.21E-04,8.77E-04,9.40E-04,1.01E-03,1.09E-03,
1.17E-03,1.26E-03,1.36E-03,1.46E-03,1.57E-03,1.67E-03,1.77E-03,1.87E-03,1.96E-03,2.05E-03,
2.14E-03,2.23E-03,2.32E-03,2.41E-03,2.51E-03,2.61E-03,2.70E-03,2.78E-03,2.86E-03,2.93E-03,
2.98E-03,3.02E-03,3.05E-03,3.08E-03,3.10E-03,3.13E-03,3.15E-03,3.15E-03,3.15E-03,3.15E-03,
3.13E-03,3.11E-03,3.08E-03,3.04E-03,3.00E-03,2.96E-03,2.91E-03,2.86E-03,2.82E-03,2.77E-03,
2.72E-03,2.68E-03,2.62E-03,2.57E-03,2.51E-03,2.45E-03,2.39E-03,2.32E-03,2.26E-03,2.20E-03,
2.13E-03,2.07E-03,2.01E-03,1.95E-03,1.89E-03,1.84E-03,1.79E-03,1.73E-03,1.68E-03,1.63E-03,
1.59E-03,1.54E-03,1.49E-03,1.45E-03,1.42E-03,1.39E-03,1.35E-03,1.33E-03,1.31E-03,1.29E-03 };
            double[] value4 = { 1.3951e-3, 1.3664e-3, 1.3415e-3, 1.3152e-3, 1.2934e-3, 1.2718e-3, 1.2449e-3, 1.2216e-3, 1.1982e-3, 1.1732e-3, 1.1507e-3, 1.1237e-3, 1.1026e-3, 1.0791e-3, 1.0559e-3, 1.0336e-3, 1.0090e-3, 9.9254e-4, 9.7047e-4, 9.4485e-4, 9.2550e-4, 9.0198e-4, 8.8614e-4, 8.6533e-4, 8.4586e-4, 8.2600e-4, 8.0414e-4, 7.8512e-4, 7.6647e-4, 7.4218e-4, 7.2607e-4, 7.0653e-4, 6.8832e-4, 6.7193e-4, 6.5559e-4, 6.3393e-4, 6.2190e-4, 6.0246e-4, 5.8610e-4, 5.7216e-4, 5.6126e-4, 5.4201e-4, 5.2240e-4, 5.1186e-4, 4.9623e-4, 4.8298e-4, 4.6742e-4, 4.5186e-4, 4.4014e-4, 4.2794e-4, 4.1736e-4, 4.0234e-4, 3.9031e-4, 3.8325e-4, 3.7462e-4, 3.6160e-4, 3.5344e-4, 3.4139e-4, 3.2917e-4, 3.1912e-4, 3.1089e-4, 3.0443e-4, 2.9296e-4, 2.8866e-4, 2.8077e-4, 2.6859e-4, 2.6091e-4, 2.5366e-4, 2.5031e-4, 2.4300e-4, 2.3467e-4, 2.3010e-4, 2.2243e-4, 2.1880e-4, 2.1478e-4, 2.0347e-4, 2.0091e-4, 1.9559e-4, 1.9653e-4, 1.9378e-4, 1.8522e-4, 1.8272e-4, 1.7756e-4, 1.7416e-4, 1.6244e-4, 1.5986e-4, 1.6073e-4, 1.5121e-4, 1.4718e-4, 1.5103e-4, 1.4749e-4, 1.4192e-4, 1.3493e-4, 1.3981e-4, 1.3382e-4, 1.2887e-4, 1.1718e-4, 1.2493e-4, 1.2665e-4, 1.2021e-4, 1.1852e-4 };

            double sum1 = 0;
            double sum2 = 0;
            string msg = "";
            for(int i = (415-380); i <= (455-380); i++)
            {
                sum1 += value1[i];
                msg += value1[i].ToString() + ",";
            }
            Debug.Print("415-455nm:" + msg);
            msg = "";

            for (int i = (400 - 380); i < value1.Length; i++)
            {
                sum2 += value1[i];
                msg += value1[i].ToString() + ",";
            }

            for(int i=(480-480);i<=(500-480);i++)
            {
                sum2 += value2[i];
                msg += value2[i].ToString() + ",";
            }
            Debug.Print("400-500nm:" + msg);

            Console.WriteLine("sum1=" + sum1.ToString());
            Console.WriteLine("sum2=" + sum2.ToString());
            Console.WriteLine("result=" + ((sum1 / sum2) * 100).ToString("F4"));
            Console.ReadKey();
        }
    }
}
